Skip to content

fix: reject zero-address signer in signature verification - #688

Merged
wjmelements merged 1 commit into
mainfrom
fix/reject-zero-signer
Dec 2, 2026
Merged

wjmelements merged 1 commit into
mainfrom
fix/reject-zero-signer

Conversation

@SgtPooki

@SgtPooki SgtPooki commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

LibSignatureVerification.recoverSigner returned whatever ecrecover produced, including address(0), which is what ecrecover returns for a well-formed signature that recovers to no key. FWSS then looked that address up as a session key. If a payer had ever authorized address(0) in SessionKeyRegistry, any such signature would have been accepted as that payer for the operations it was authorized for.

This is hardening: it only matters for a payer that has authorized the zero address.

Change

  • recoverSigner reverts with a new Errors.SignatureRecoveryFailed() when the recovered address is zero. Both FWSS verification paths (CreateDataSet, and the shared path for the other signed operations) go through it, so the check runs before any session key lookup.
  • ServiceProviderRegistry._recoverSigner already rejected a zero result; this brings FWSS in line with it.
  • ABIs and the generated IFilecoinWarmStorageService are regenerated for the new error. Changelog entry added under Unreleased.

SessionKeyRegistry

It would also be reasonable for login() to refuse address(0). That contract is not in this repo: it comes from the lib/session-key-registry submodule (FilOzone/SessionKeyRegistry) and is deployed as a plain, non-upgradeable contract, so it is not changed here.

Related

FilOzone/synapse-sdk#1192 adds the client-side counterpart: the SDK refuses to authorize the zero address as a session key.

Verification

  • New tests, which fail on main and pass with the change:
    • testRecoverSignerRejectsZeroAddress: a zero-recovering signature reverts with SignatureRecoveryFailed.
    • testVerifyRejectsZeroSignerEvenWhenPayerAuthorizedIt: the same signature is rejected even after the payer logs address(0) in for CreateDataSet.
  • testVerifyAcceptsPayerAndAuthorizedSessionKey: a valid payer signature and a valid authorized session key signature still pass.
  • forge fmt --check, forge lint --deny notes, make build, make gen and make update-abi are clean. make test: 1179 passed, 0 failed across 39 suites. make contract-size-check passes. make check-josuke reports no blocking findings.
  • Run under Foundry's EVM only; not exercised on an FVM node.

@SgtPooki SgtPooki left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review.. not familiar with solidity too much but it looks coherent and straightforward

@SgtPooki
SgtPooki marked this pull request as ready for review December 1, 2026 21:25
Copilot AI balanced review requested due to automatic review settings December 1, 2026 21:25
@SgtPooki SgtPooki self-assigned this Dec 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the signature-verification hardening.

No open issues 🎉

What changed in this PR

Hardens Filecoin Warm Storage Service signature verification by rejecting zero-address recovery before session-key lookup. This prevents invalid signatures from being accepted when a payer has authorized address(0).

Changes:

  • Reject zero-address signers with the new SignatureRecoveryFailed() error.
  • Add regression tests for zero-address rejection and valid payer/session-key signatures.
  • Update generated interfaces, ABIs, and the changelog.
File Description
service_contracts/​test/​FilecoinWarmStorageService.t.sol Tests zero-address rejection and valid signature acceptance.
service_contracts/​src/​lib/​LibSignatureVerification.sol Rejects zero-address recovery before returning the signer.
service_contracts/​src/​interfaces/​IFilecoinWarmStorageService.sol Exposes the new recovery error.
service_contracts/​src/​Errors.sol Defines SignatureRecoveryFailed().
service_contracts/​abi/​FilecoinWarmStorageService.abi.json Adds the recovery error to the service ABI.
service_contracts/​abi/​Errors.abi.json Adds the recovery error to the errors ABI.
CHANGELOG.md Documents the signature-verification hardening.

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this from 📌 Triage to ✔️ Approved by reviewer in FOC Dec 2, 2026
@wjmelements
wjmelements merged commit 7b1045b into main Dec 2, 2026
9 checks passed
@wjmelements
wjmelements deleted the fix/reject-zero-signer branch December 2, 2026 01:02
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

3 participants